/**
 * 保存数据
 */
function saveData(name, arrays){
    var obj = {};
    if (arrays != null && arrays.length > 0) {
        arrays.forEach(function(item){
            obj[item.dataKey] = item.dataValue;
        });
    }
    localStorage.setItem(name, JSON.stringify(obj));
}

/**
 * 获取数据-根据key
 */
function getData(name, key){
    var obj = JSON.parse(localStorage.getItem(name));
    if (obj != null) {
        return obj[key];
    }
}

/**
 * 获取所有的key-value
 */
function getAllData(name){
    return JSON.parse(localStorage.getItem(name));
}